import {companyTypeStr} from '@const/common.js'
// 表头定义
export const appsColumns = [
  {type: 'index', label: '序号', width: '60'},
  {prop: 'appCode', label: '系统编码', width: '130'},
  {prop: 'appLogo', label: 'appLogo', width: '120'},
  {prop: 'appName', label: 'app名称', width: '150'},
  {prop: 'appName', label: 'app类型', width: '150'},
  {prop: 'domain', label: 'app地址', minWidth: '400'},
  {prop: 'appDesc', label: '描述', minWidth: '300'},
  {prop: 'operation', label: '操作', fixed: 'right', width: '170'}
]
export const menu_type = {
  1: '菜单',
  2: '按钮',
  3: '菜单'
}
// 菜单管理表头定义
export const menuColumns = [
  {type: 'index', label: '序号', width: '60'},
  {prop: 'resourceCode', label: '自定义唯一标识码', width: '150'},
  {prop: 'resourceName', label: '菜单名称', width: '120'},
  {
    prop: 'resourceTypeStr',
    label: '菜单类型',
    width: '150'
  },
  {prop: 'parentName', label: '按钮归属', width: '150'},
  {prop: 'resourcePath', label: '菜单地址', minWidth: '400'},
  {prop: 'resourceIcon', label: 'icon编码', minWidth: '300'},
  {prop: 'operation', label: '操作', fixed: 'right', width: '170'}
]
// 导航菜单管理表头定义
export const navMenuColumns = [
  {type: 'index', label: '序号', minWidth: '60'},
  {prop: 'resourceCode', label: '自定义唯一标识码', minWidth: '150'},
  {prop: 'resourceName', label: '菜单名称', minWidth: '120'},
  {
    prop: 'resourceTypeStr',
    label: '菜单类型',
    minWidth: '150'
  },
  {prop: 'resourceIcon', label: 'icon编码', minWidth: '300'},
  {prop: 'operation', label: '操作', fixed: 'right', minWidth: '170'}
]

// 表单校验
export const formRules = {
  groupCode: [{required: true, message: '请选择子系统分组', trigger: 'blur'}],
  companyType: [
    {required: true, message: '请选择子系统所属类型', trigger: 'blur'}
  ],
  appName: [{required: true, message: '请输入子系统名称', trigger: 'blur'}],
  appCode: [{required: true, message: '请输入子系统编码', trigger: 'blur'}],
  domain: [{required: true, message: '请输入子系统地址', trigger: 'blur'}]
}
// 菜单管理/新增/编辑
export const formMenuRules = {
  id: [{required: true, message: '请选择菜单', trigger: 'blur'}],
  mid: [{required: true, message: '请选择菜单', trigger: 'blur'}],
  resourceName: [{required: true, message: '请输入', trigger: 'blur'}],
  resourceCode: [{required: true, message: '请输入', trigger: 'blur'}],
  resourcePath: [{required: true, message: '请输入', trigger: 'blur'}]
}
// 添加菜单校验/修改子系统
export const menuRule = {
  name: [{required: true, message: '请输入菜单名称', trigger: 'blur'}],
  type: [{required: true, message: '请输入菜单名称', trigger: 'blur'}],
  groupCode: [{required: true, message: '请选择子系统名称', trigger: 'blur'}],
  companyType: [{required: true, message: '请选择所属类型', trigger: 'blur'}],
  resourceName: [{required: true, message: '请输入app名称', trigger: 'blur'}],
  appType: [{required: true, message: '请输入app类型', trigger: 'blur'}],
  appCode: [{required: true, message: '请输入app编码', trigger: 'blur'}],
  domain: [{required: true, message: '请输入app地址', trigger: 'blur'}]
}
export const menu_status = {
  '': '全部',
  1: '有效',
  2: '停用'
  // 3: '冻结'
}
// 菜单管理form
export const searchContent = [
  {
    key: 'resourceName',
    title: '关键字',
    type: 'input',
    attr: {
      placeholder: '请输入'
    }
  },
  {
    key: 'status',
    title: '状态',
    type: 'select',
    attr: {
      placeholder: '请选择'
    },
    options: Object.keys(menu_status).map(item => {
      return {
        label: menu_status[item],
        value: item
      }
    })
  }
]
